Creating functions for accessing properties Permalink

  1. Click “Project  Project Information”.

    The “Project Information” dialog opens.

  2. Select the “Automatically generate 'Project Information' POUs” option.

Example

Requirement: The following property is defined.

Schlüssel = nProp1
Typ= Zahl
Wert= 333
  1. Select the “Automatically generate 'Project Information' POUs” option.

  2. Declare a ‎DINT‎ type variable.

    Example: ‎showprop : DINT;‎

  3. Call the function ‎GetNumberProperty‎: ‎showprop := GetNumberProperty("nProp1");‎

    You are granted access to the value in the application.

Note: The functions that are created with the “Automatically generate 'Project Information' POUs” option can be used only if the runtime supports the ‎WSTRING‎ data type. If this is not the case, then instead you can apply the “Automatically generate 'Library Information' POUs” option. You can use the functions created in this way at least in the application to access properties. These functions are not registered in the runtime.